declare namespace Excel {

  // 尺寸模式 固定尺寸 、跟随窗口
  type SizeType = 'regular' | 'follow'

  // 自定义配置工具栏，可以与showtoolbar配合使用，showtoolbarConfig拥有更高的优先级。
  type ShowtoolbarConfig = {
    undoRedo?: boolean, //撤销重做，注意撤消重做是两个按钮，由这一个配置决定显示还是隐藏
    paintFormat?: boolean, //格式刷
    currencyFormat?: boolean, //货币格式
    percentageFormat?: boolean, //百分比格式
    numberDecrease?: boolean, // '减少小数位数'
    numberIncrease?: boolean, // '增加小数位数
    moreFormats?: boolean, // '更多格式'
    font?: boolean, // '字体'
    fontSize?: boolean, // '字号大小'
    bold?: boolean, // '粗体 (Ctrl+B)'
    italic?: boolean, // '斜体 (Ctrl+I)'
    strikethrough?: boolean, // '删除线 (Alt+Shift+5)'
    underline?: boolean, // '下划线 (Alt+Shift+6)'
    textColor?: boolean, // '文本颜色'
    fillColor?: boolean, // '单元格颜色'
    border?: boolean, // '边框'
    mergeCell?: boolean, // '合并单元格'
    horizontalAlignMode?: boolean, // '水平对齐方式'
    verticalAlignMode?: boolean, // '垂直对齐方式'
    textWrapMode?: boolean, // '换行方式'
    textRotateMode?: boolean, // '文本旋转方式'
    image?: boolean, // '插入图片'
    link?: boolean, // '插入链接'
    chart?: boolean, // '图表'（图标隐藏，但是如果配置了chart插件，右击仍然可以新建图表）
    postil?: boolean, //'批注'
    pivotTable?: boolean,  //'数据透视表'
    function?: boolean, // '公式'
    frozenMode?: boolean, // '冻结方式'
    sortAndFilter?: boolean, // '排序和筛选'
    conditionalFormat?: boolean, // '条件格式'
    dataVerification?: boolean, // '数据验证'
    splitColumn?: boolean, // '分列'
    screenshot?: boolean, // '截图'
    findAndReplace?: boolean, // '查找替换'
    protection?: boolean, // '工作表保护'
    print?: boolean, // '打印'
  }
  type SheetbarConfig = {
    add: boolean, //新增sheet
    menu: boolean, //sheet管理菜单
    sheet: boolean //sheet页显示
  }
  type StatisticBarConfig = {
    count: boolean, // 计数栏
    view: boolean, // 打印视图
    zoom: boolean, // 缩放
  }
  type Hook = {
    cellEditBefore?: void,
    cellUpdateBefore?: void,
    cellUpdated?: void,
    cellRenderBefore?: void,
    cellRenderAfter?: void,
    cellAllRenderBefore?: void,
    rowTitleCellRenderBefore?: void,
    rowTitleCellRenderAfter?: void,
    columnTitleCellRenderBefore?: void,
    columnTitleCellRenderAfter?: void,
    cellMousedownBefore?: void,
    cellMousedown?: any,

    sheetMousemove?: void,
    sheetMouseup?: any,
    scroll?: void,
    cellDragStop?: void,
    rangeSelect?: void,
    rangeMoveBefore?: void,
    rangeMoveAfter?: void,
    rangeEditBefore?: void,
    rangeEditAfter?: void,
    rangeCopyBefore?: void,
    rangeCopyAfter?: void,
    rangePasteBefore?: void,
    rangePasteAfter?: void,

    rangeCutBefore?: void,
    rangeCutAfter?: void,
    rangeDeleteBefore?: void,
    rangeDeleteAfter?: void,
    rangeClearBefore?: void,
    rangeClearAfter?: void,
    rangePullBefore?: void,
    rangePullAfter?: void,

    sheetCreatekBefore?: void,
    sheetCreateAfter?: void,
    sheetMoveBefore?: void,
    sheetMoveAfter?: void,
    sheetDeleteBefore?: void,
    sheetDeleteAfter?: void,
    sheetEditNameBefore?: void,
    sheetEditNameAfter?: void,
    sheetEditColorBefore?: void,
    sheetEditColorAfter?: void,
    sheetZoomBefore?: void,
    sheetZoomAfter?: void,
    sheetActivate?: void,
    sheetDeactivateBefore?: void,
    sheetDeactivateAfter?: void,

    workbookCreateBefore?: void,
    workbookDestroyBefore?: void,
    workbookDestroyAfter?: void,
    workbookCreateAfter?: void,

    updated?: void,
    resized?: void,

    imageInsertBefore?: void,
    imageInsertAfter?: void,
    imageUpdateBefore?: void,
    imageUpdateAfter?: void,
    imageDeleteBefore?: void,
    imageDeleteAfter?: void,

    commentInsertBefore?: void,
    commentInsertAfter?: void,
    commentDeleteBefore?: void,
    commentDeleteAfter?: void,
    commentUpdateBefore?: void,
    commentUpdateAfter?: void,

    pivotTableEditBefore?: void,
    pivotTableEditAfter?: void,

    frozenCreateBefore?: void,
    frozenCreateAfter?: void,
    frozenCancelBefore?: void,
    frozenCancelAfter?: void,

    printBefore?: void,
    fireMousedown?: void,
    onTogglePager?: void,
  }
  type Config = {
    autoload: boolean,
    title?: string,
    lang?: string,
    data?: Sheet[],
    gridKey?: string,
    showTitle?: boolean,
    showtoolbar: boolean,
    showtoolbarConfig?: ShowtoolbarConfig,
    showinfobar?: boolean, //是否显示顶部信息栏
    showsheetbar?: boolean, //是否显示底部sheet页按钮
    showsheetbarConfig?: SheetbarConfig[],
    showstatisticBar?: boolean,
    showstatisticBarConfig?: StatisticBarConfig[],
    enableAddRow?: boolean,
    enableAddBackTop?: boolean,
    userInfo?: any, //右上角的用户信息展示样式，支持HTML模板字符串、普通字符串、Boolean类型（不展示用户信息/展示默认的字符串）
    userMenuItem?: any[],
    myFolderUrl?: string,
    devicePixelRatio?: number,
    functionButton?: string,
    showConfigWindowResize?: boolean,
    forceCalculation?: boolean,
    cellRightClickConfig?: {
      copy?: boolean, // 复制
      copyAs?: boolean, // 复制为
      paste?: boolean, // 粘贴
      insertRow?: boolean, // 插入行
      insertColumn?: boolean, // 插入列
      deleteRow?: boolean, // 删除选中行
      deleteColumn?: boolean, // 删除选中列
      deleteCell?: boolean, // 删除单元格
      hideRow?: boolean, // 隐藏选中行和显示选中行
      hideColumn?: boolean, // 隐藏选中列和显示选中列
      rowHeight?: boolean, // 行高
      columnWidth?: boolean, // 列宽
      clear?: boolean, // 清除内容
      matrix?: boolean, // 矩阵操作选区
      sort?: boolean, // 排序选区
      filter?: boolean, // 筛选选区
      chart?: boolean, // 图表生成
      image?: boolean, // 插入图片
      link?: boolean, // 插入链接
      data?: boolean, // 数据验证
      cellFormat?: boolean // 设置单元格格式
    },
    sheetRightClickConfig?: {
      delete: boolean, // 删除
      copy: boolean, // 复制
      rename: boolean, //重命名
      color: boolean, //更改颜色
      hide: boolean, //隐藏，取消隐藏
      move: boolean, //向左移，向右移
    },
    rowHeaderWidth?: number,
    columnHeaderHeight?: number,
    sheetFormulaBar?: boolean,
    defaultFontSize?: number,
    limitSheetNameLength?: boolean,
    defaultSheetNameMaxLength?: number,
    pager?: {
      pageIndex: number, //当前的页码
      pageSize: number, //每页显示多少行数据
      total: number, //数据总行数
      selectOption: number[] //允许设置每页行数的选项
    },
    hook: Hook,
    width?: number,
    height?: number,
    sizeType?: SizeType,
    custom?: {
      headRow: number
    }
  }
  type Sheet = {
    name?: string,
    color?: string,
    index?: number, //工作表索引
    status?: number, //激活状态
    order?: number, //工作表的下标
    hide?: number,//是否隐藏
    row?: number, //行数
    column?: number, //列数
    defaultRowHeight?: number, //自定义行高
    defaultColWidth?: number, //自定义列宽
    celldata?: Cell[], //初始化使用的单元格数据
    config?: {
      merge: object, //合并单元格
      rowlen: object, //表格行高
      columnlen: object, //表格列宽
      rowhidden: object, //隐藏行
      colhidden: object, //隐藏列
      borderInfo: object, //边框
      authority: Authority, //工作表保护

    },
    scrollLeft?: number, //左右滚动条位置
    scrollTop?: number, //上下滚动条位置
    luckysheet_select_save?: any[], //选中的区域
    calcChain?: any[],//公式链
    isPivotTable?: boolean,//是否数据透视表
    pivotTable?: object,//数据透视表设置
    filter_select?: object,//筛选范围
    filter?: any,//筛选配置
    luckysheet_alternateformat_save?: any[], //交替颜色
    luckysheet_alternateformat_save_modelCustom?: any[], //自定义交替颜色
    luckysheet_conditionformat_save?: object,//条件格式
    frozen?: object, //冻结行列配置
    chart?: any[], //图表配置
    zoomRatio?: number, // 缩放比例
    image?: any[], //图片
    showGridLines?: number, //是否显示网格线
    dataVerification?: object //数据验证配置
  }
  type Authority = {
    selectLockedCells: number, //选定锁定单元格
    selectunLockedCells: number, //选定解除锁定的单元格
    formatCells: number, //设置单元格格式
    formatColumns: number, //设置列格式
    formatRows: number, //设置行格式
    insertColumns: number, //插入列
    insertRows: number, //插入行
    insertHyperlinks: number, //插入超链接
    deleteColumns: number, //删除列
    deleteRows: number, //删除行
    sort: number, //排序
    filter: number, //使用自动筛选
    usePivotTablereports: number, //使用数据透视表和报表
    editObjects: number, //编辑对象
    editScenarios: number, //编辑方案
    sheet: number, //如果为1或true，则该工作表受到保护；如果为0或false，则该工作表不受保护。
    hintText: string, //弹窗提示的文字
    algorithmName: string,//加密方案：MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL
    saltValue: string, //密码解密的盐参数，为一个自己定的随机数值
    isAlert: number, //是否弹窗提示
    allowRangeList: [{ //区域保护
      name: string, //名称
      password: string, //密码
      hintText: string, //提示文字
      algorithmName: string,//加密方案：MD2,MD4,MD5,RIPEMD-128,RIPEMD-160,SHA-1,SHA-256,SHA-384,SHA-512,WHIRLPOOL
      saltValue: string, //密码解密的盐参数，为一个自己定的随机数值
      sqref: string //区域范围
    }],
  }
  type Cell = {
    ct: {
      fa: string,
      t: string
    },
    v: number,
    m: number,
    bg: string,
    ff: number,
    fc: string,
    bl: number,
    it: number,
    fs: number,
    cl: number,
    ht: number,
    vt: number,
    tr: number,
    tb: number,
    ps: {
      left: number,
      top: number,
      width: number,
      height: number,
      value: string,
      isshow: boolean
    },
    f: string
  }
}
